    posts_no_thumb_sum = 1000;
    posts_thumb_sum = 1000;
    img_thumb_height = 160;
    img_thumb_width = 180;

    function removeHtmlTag(strx, chop) {
    	if (strx.indexOf("<") != -1) {
    		var s = strx.split("<");
    		for (var i = 0; i < s.length; i++) {
    			if (s[i].indexOf(">") != -1) {
    				//console.log(s[i])
    				if ( (s[i] == "br>") || (s[i] == "br/>") || (s[i] == "br />")) {

    				} else {
    					var t = s[i].substring(s[i].indexOf(">") + 1, s[i].length)
    					if ((t != "") || (t != "\n")) {
    						s[i] = "<p class='readmore-p'>" + s[i].substring(s[i].indexOf(">") + 1, s[i].length) + "</p>"

    					} else {

    						s[i] = s[i].substring(s[i].indexOf(">") + 1, s[i].length)
    					}


    				}
    			}
    		}
    		strx = s.join("");
    	}
    	chop = (chop < strx.length - 1) ? chop : strx.length - 2;

    	while (strx.charAt(chop - 1) != ' ' && strx.indexOf(' ', chop) != -1) chop++;
    	strx = strx.substring(0, chop - 1);
    	var dot = strx.split(".")
    	dot = dot.splice(0, dot.length - 1).join(".") + "."
    	return dot;

    }

    function createSummaryAndThumb(pID, pURL, pTITLE) {
    	var div = document.getElementById(pID);
    	var imgtag = "";
    	var img = div.getElementsByTagName("img");
    	var summ = posts_no_thumb_sum;
    	if (img.length >= 1) {
    		imgtag = '<div  style="background-color: white; color: #555555; margin-bottom: 0.8em; margin-top: 0.4em;"><a class="readmore-a-pic" href="' + pURL + '" title="' + pTITLE + '"><img style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;" src="' + img[0].src + '" width="400px"></img></a>';
    		summ = posts_thumb_sum;
    	} else {
    		//if video support 
    		var video = div.getElementsByTagName("video");
		video[0].setAttribute("class","radmore-video");
    		if (video.length >=1) {
    			var html =video[0].outerHTML;
				imgtag = '<div  style="background-color: white; color: #555555; margin-bottom: 0.8em; margin-top: 0.4em;"><a class="readmore-a-pic" href="' + pURL + '" title="' + pTITLE + '">'+html+'</a>';

    		} else {
    			    		imgtag = '<div  style="background-color: white; color: #555555; margin-bottom: 0.8em; margin-top: 0.4em;">';
    		}
    	}
    	var summary = imgtag + removeHtmlTag(div.innerHTML, summ) + '</div>';
    	div.innerHTML = summary;
    	//console.log(imgtag)
    	if (div.getElementsByTagName("video").length >=1) {
    		$("video","#"+pID).eq(0).attr("width","400px");
    				$("video","#"+pID).eq(0).css({"height":"300px","float":"left", "margin-bottom": "1em", "margin-right": "1em"})
    	}
    	//hover,click event
    	$("#"+pID).hover(function (){
			$(this).css( 'cursor', 'pointer');
			$(this).attr("title","Click to read more about:\n"+pTITLE) 	
    	});
    	$("#"+pID).click(function (){
    		window.open(pURL);
    	});
    }